#include "mainwindow.h"
#include <QApplication>
#include <QPushButton>
#include "newspaper.h"
#include "reader.h"

int main(int argc, char* argv[])
{
    QApplication a(argc, argv);
    QMainWindow w;
    Newspaper nspp("I am newspaper!");
    Reader rd;
    QObject::connect(&nspp, &Newspaper::pblsNewspaper, &rd, &Reader::rcvNewspaper);
    nspp.publish();
    nspp.publish("Me too!");
    QPushButton pbtn("publish", &w);
    //    void (Newspaper::*publishName)() = &Newspaper::publish;
    //    QObject::connect(&pbtn, &QPushButton::clicked, &nspp, publishName);
    QObject::connect(&pbtn, &QPushButton::clicked, &nspp,
                     static_cast<void (Newspaper::*)()>(&Newspaper::publish));
    //    pbtn.show();
    w.show();
    return a.exec();
}
